function [alpha,delays,ts,Na,x,k0] = general(x)
    global S
    x(max(x,[],2)==0,:)=[]; % 删掉空行，方便计算
    x(:,max(x)==0)=[]; % 删掉空列，方便计算
    [Na,k0]=size(x);
    alpha=sum(x~=0,2);
    x=[zeros(Na,1),x,zeros(Na,1)];
    delays=zeros(Na,k0+1);
    ts=zeros(Na,k0+1);
    for k=0:k0
        ts(:,k+1)=sqrt(sum((S(x(:,k+2)+1,:)-S(x(:,k+1)+1,:)).^2,2));
        delays(:,k+1)=ts(:,k+1)*k;
    end
end